package org.qq.serverthread;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * 
 * project_name:QQ
 * package_name:org.link.thread
 * file_name:ServerThread.java
 * @author Link
 * create_date:2015年8月28日 下午3:49:42
 * modified_date:
 * description: 服务器监听线程
 *
 */
public class ServerThread extends Thread{
	
	private ServerSocket serverSocket;		//服务器
	private Socket s;						//用户
	
	public ServerThread() {//无參构造方法
		super();
	}


	public ServerThread(ServerSocket serverSocket) {//
		super();
		this.serverSocket = serverSocket;
	}
	
	@Override
	public void run() {
		// TODO Auto-generated method stub
		while(true){
			try {
				s = serverSocket.accept();
				ServerDiposeThread sdt = new ServerDiposeThread(s);
				sdt.start();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	/**
	 * 
	 * description: 属性的setter和getter方法
	 * 2015年8月28日 下午3:51:16
	 * @author Link
	 * ServerSocket
	 *
	 */
	public ServerSocket getServerSocket() {
		return serverSocket;
	}


	public void setServerSocket(ServerSocket serverSocket) {
		this.serverSocket = serverSocket;
	}


	public Socket getS() {
		return s;
	}


	public void setS(Socket s) {
		this.s = s;
	}
	
	
}

